#ifndef CustomServo_h
#define CustomServo_h
#include <inttypes.h>
class ServoC
{
  private:
    uint8_t pin;
    uint8_t angle;       // in degrees
    unsigned long pulse0;     // pulse width in TCNT0 counts
    unsigned long minpulse;       // minimum pulse, 16uS units  (default is 34) // should be in progmem
    unsigned long maxpulse;       // maximum pulse, 16uS units, 0-4ms range (default is 150) // should be in progmem
    unsigned long risefalltime;
    bool lastedgerise;
  public:
    ServoC( uint8_t pin, uint8_t angle, unsigned long mintime, unsigned long maxtime );
    void write(int);         // specify the angle in degrees, 0 to 180
    void refresh();    // must be called at least every 50ms or so to keep servo alive
                              // you can call more often, it won't happen more than once every 20ms
    unsigned long readpulse();
    int readangle(); 
};

#endif
